home *** CD-ROM | disk | FTP | other *** search
- # ABuild
- #
- Set MB-WEBPAGE "<http://www.metamage.com/proj/aline.html>"
- Set MB-SERIAL "2000031701"
- Set MB-COMPAT "1999111101"
- #
- # Synopsis:
- # ABuild <target>
- # [ --dist ]
- # [ --depend ]
- # [ --check | --commands | --make ]
- # [ --arch 68K | PPC | Fat ]
- # [ --build Debug | Release | all ]
- #
- # Options:
- # --make # Run dmake for this target and run the commands it outputs.
- # --dist # Take a snapshot (immediately). Assumes you use my system.
- # --depend # Run MakeDepend to generate dependencies. Requires Perl.
- # --arch # Specify which architecture to build for. No PPC support yet.
- # --build # Specify which build type.
- # --nested # Used internally. Basically, it suppresses output redirection.
- #
- # The options --dist and --depend are for maintainer use and may not run on
- # your system. Both require Perl. Use --depend if you change the dependencies
- # of the project (e.g. add files). You shouldn't have any need of --dist, but
- # if you try it, be aware that it indirectly uses hardcoded pathnames, assumes your
- # date format is yyyy.mm.dd, and generally makes unwarranted assumptions.
- #
- # You should probably do --distclean before --dist unless you want that stuff in
- # the snapshot. You can also do --make on the same command line to recreate the
- # stuff you just blasted with --distclean, but the order is important!
-
-
- # Start the timer
- Set TIME0 `date -n`
-
- # Make sure we have what to build
- If {#} < 1
- # We can change this later. Maybe add a dialog box to pick one.
- Echo "{0}: You must specify a target project to build."
- Exit
- End
-
- # Set some variables
- Execute "ALDirMacros"
- set NAME "{1}"
- set TARG "{TARGS}{1}:"
- set PROFILE "{TARG}{MANIFEST}:Profile.mpwsh"
- shift
-
- # Defaults
- Set ARCH "--default"
- Set BUILD "--default"
- Set MAKEFILE "{SCRIPTS}Master.mk"
-
- # Make sure the target directory (the Source folder) and the Build script exist.
- If "`Exists -d "{TARG}"`" == ""
- Echo "{0}: Target '{TARG}' does not exist."
- Exit 1
- Else if "`Exists -f "{PROFILE}"`" == ""
- #echo "{0}: Build profile '{PROFILE}' does not exist."
- #exit 1
- End
-
- # Parse the command line.
- Loop
- Break If {#} == 0
- If "{1}" == "--dist"
- Echo "Taking a snapshot of {NAME}."
- SnapShot --verbose "{TARG}:"
- shift
- else if "{1}" == "--depend"
- Set MAKEDEPEND " --depend"
- shift
- else if "{1}" == "--arch"
- set ARCH "{2}"
- Shift; Shift
- else if "{1}" == "--build"
- Set BUILD "{2}"
- Shift; Shift
- else if "{1}" == "--nested"
- set NESTED yup
- shift
- else if "{1}" == "--make"
- set ACTION make
- shift
- else
- echo "{0}: Error: Unknown thing '{1}' on the command line."
- exit 1
- end
- end
-
- If !"{ACTION}" && !"{MAKEDEPEND}"
- Exit
- End
-
-
- # Open a new window to scribble in.
- if "{NESTED}" == ""
- set OUT "{MPW}Build output"
- begin
- echo "• A-line •"
- echo ""
- echo "By Joshua Juran"
- echo ""
- end > "{OUT}"
- Open "{OUT}"
- else
- set OUT "Dev:stdout"
- end
-
-
- begin
-
- # Save the current default directory and call the Build script.
- Set SAVEDIR "`Directory`"
- Directory "{TARG}"
-
- If "`exists -f "{PROFILE}"`"
- Execute "{PROFILE}"
- If "{DESC}" != ""
- Set COMMASPACE ", "
- End
- If "{MB-NEEDED}" > "{MB-SERIAL}"
- Echo "Sorry, A-line {MB-SERIAL} is insufficient to build {NAME}."
- Echo "Please get {MB-NEEDED} or later from {MB-WEBPAGE}."
- Exit 1
- End
- If "{MB-AWARE}" < "{MB-COMPAT}"
- Echo "Sorry, {NAME} is incompatible with A-line {MB-SERIAL}."
- Echo "(It's only aware of A-line {MB-AWARE}.)"
- Echo "Please upgrade it to a version that supports {MB-COMPAT}. {PROJ-WEBPAGE}"
- Exit 1
- End
- End
-
- # Mainly something to click on and hit Enter to rebuild
- echo "Building {NAME}"
- begin
- set SAVEEXIT {Exit}
- set Exit 0
- echo `echo "Building {NAME}" | sed "s/./=/g"`
- set Exit {SAVEEXIT}
- end ≥ Dev:null
- echo ""
- echo -n "({0} {NAME} --{ACTION}{SKIP}"
- If "{ARCH}"
- Echo -n " --arch {ARCH}"
- End
- If "{BUILD}"
- Echo -n " --build {BUILD}"
- End
- Echo ")"
- Echo ""
-
- # If !`Exists "{TARG}{PREGEN}:Sources.mk"`
- # MakeSource
- # End
- # If !`Exists "{TARG}{PREGEN}:Imports.mk"`
- # MakeImports
- # End
- # Set DEPFILE "{TARG}{PREGEN}:Dependencies.mk"
- # If "{MAKEDEPEND}" || !`Exists "{DEPFILE}"`
- # Echo "Examining dependencies of {NAME}."
- #set DEPSTART `date -n`
- # MakeDepend
- #set DEPEND `date -n`
- #Echo "Analyzing dependencies took `Evaluate {DEPEND} - {DEPSTART}` seconds."
- # End
-
- If "{BUILD}" == "all"
- Echo "Building all build types."
- Echo ""
- "{0}" "{NAME}" --nested --{ACTION} --arch {ARCH} --build Debug
- "{0}" "{NAME}" --nested --{ACTION} --arch {ARCH} --build Release
- Echo "Multi-build complete."
- Exit
- End
-
- set TIME1 `date -n`
- set TIME2 {TIME1}
- If "{PREBUILD}" != ""
- for DEP in {PREBUILD} # No quotes
- Echo "{NAME} depends on {DEP}. Building that first."
- Echo ""
- "{0}" "{DEP}" --nested --make --arch {ARCH} --build {BUILD}
- end
- echo "All prerequisite projects built. Proceeding with {NAME}."
- echo ""
- set TIME2 `date -n`
- End
-
- AMake --arch "{ARCH}" --build "{BUILD}"
-
- end >> "{OUT}" ≥≥ "Dev:stdout"
-
- # No quotes here!
- Directory {SAVEDIR}
- #PlaySound "Sosumi"
-
-
- Exit
- # The end.
-